import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '物业编号',
    align:"center",
    dataIndex: 'wybh'
   },
   {
    title: '物业地址',
    align:"center",
    dataIndex: 'wydz'
   },
   {
    title: '使用企业',
    align:"center",
    dataIndex: 'syqy'
   },
   {
    title: '物业状态',
    align:"center",
    dataIndex: 'syzt'
   },
   {
    title: '土地面积',
    align:"center",
    dataIndex: 'tdmj'
   },
   {
    title: '土地证面积',
    align:"center",
    dataIndex: 'httdmj'
   },
   {
    title: '使用建筑面积',
    align:"center",
    dataIndex: 'jzmj'
   },
   {
    title: '总建筑面积',
    align:"center",
    dataIndex: 'jsjmj'
   },
   {
    title: '管理费面积',
    align:"center",
    dataIndex: 'glfmj'
   },
   {
    title: '备注',
    align:"center",
    dataIndex: 'bz'
   },
/*   {
    title: 'zj',
    align:"center",
    dataIndex: 'zj'
   },*/
/*   {
    title: 'zgsj',
    align:"center",
    dataIndex: 'zgsj',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },*/
];
//查询数据
export const searchFormSchema: FormSchema[] = [
	{
      label: "物业地址",
      field: 'wydz',
      component: 'JInput',
      colProps: {span: 6},
 	},
	{
      label: "使用企业",
      field: 'syqy',
      component: 'JInput',
      colProps: {span: 6},
 	},
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '物业编号',
    field: 'wybh',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入物业编号!'},
          ];
     },
  },
  {
    label: '物业地址',
    field: 'wydz',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入物业地址!'},
          ];
     },
  },
  {
    label: '使用企业',
    field: 'syqy',
    component: 'Input',
  },
  {
    label: '物业状态',
    field: 'syzt',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入物业状态!'},
          ];
     },
  },
  {
    label: '土地面积',
    field: 'tdmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入土地面积!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '土地证面积',
    field: 'httdmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入土地证面积!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '使用建筑面积',
    field: 'jzmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入使用建筑面积!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '总建筑面积',
    field: 'jsjmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入总建筑面积!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },
  {
    label: '管理费面积',
    field: 'glfmj',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入管理费面积!'},
                 { pattern: /^-?\d+\.?\d*$/, message: '请输入数字!'},
          ];
     },
  },

  {
    label: '备注',
    field: 'bz',
    component: 'InputTextArea',
  },
/*  {
    label: 'zj',
    field: 'zj',
    component: 'InputNumber',
  },*/
/*  {
    label: 'zgsj',
    field: 'zgsj',
    component: 'DatePicker',
  },*/
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
